<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<body>
    <input type="button" id="a" value="按钮">
    <a href="https://www.baidu.com" id="b">百度</a>
    <script src="https://cdn.bootcdn.net/ajax/libs/jquery/3.7.1/jquery.js"></script>
    <script>
        // $(function(){...}) 是 jQuery 中的一种简写语法，它等价于 $(document).ready(function(){...})
        $(document).ready(function() {
            $("#a").click(function() {
                alert("按钮被点击了");
            });
            $("#b").click(function(){
                alert("链接被点击了");
            })
            $("#b").attr("href", "https://www.google.com");
        });
    </script>
</body>
</html>